package org.ccams.dao;

import java.util.List;

import org.ccams.domain.TpMovbackH;
import org.ccams.util.PageParameter;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class TpMovbackHDAO extends SqlMapClientDaoSupport{
	
	/**
	 * 根据page中的参数返回记录 
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public  List<TpMovbackH> getTpmovbackhByPage(PageParameter page){		
		return getSqlMapClientTemplate().queryForList("tp_movback_h.getTpmovbackhByPage",page);
	}
	
	@SuppressWarnings("unchecked")
	public  TpMovbackH getTpmovbackhByNum(Long num){		
		return (TpMovbackH)getSqlMapClientTemplate().queryForObject("tp_movback_h.getTpmovbackhByNum",num);
	}
	
	public TpMovbackH getTpmovbackhByMovno(String mov_no){
		return (TpMovbackH)getSqlMapClientTemplate().queryForObject("tp_movback_h.getTpmovbackhByMovno",mov_no);
	}
	
	public Long getLastNum(){
		return (Long)getSqlMapClientTemplate().queryForObject("tp_movback_h.getLastNum");
	}
	/**
	 * 返回记录行数
	 * @return
	 *//*
	public Integer getCount(){
		return (Integer)getSqlMapClientTemplate().queryForObject("tp_movback_h.getCount");
	}
	*//**
	 * 根据审核状态返回记录行数
	 * @param page
	 * @return
	 */
	public Integer getCountByPage(PageParameter page){
		return (Integer)getSqlMapClientTemplate().queryForObject("tp_movback_h.getCountByPage",page);
	}
	/**
	 * 插入数据
	 * @param toh
	 * @return
	 */
	public int insertTpmovbackh(TpMovbackH tmh) {
		return getSqlMapClientTemplate().update("tp_movback_h.insertTpmovbackh",tmh);
	}
	/**
	 * 更新数据
	 * @param toh
	 * @return
	 */
	public int updateTpmovbackh(TpMovbackH tmh){
		return getSqlMapClientTemplate().update("tp_movback_h.updateTpmovbackh",tmh);
	}
	/**
	 * 删除数据
	 * @param num
	 * @return
	 */
	public int deleteTpmovbackh(Long num){
		return getSqlMapClientTemplate().delete("tp_movback_h.deleteTpmovbackh",num);
	}
	
	public String getLastMovno(){
		return (String)getSqlMapClientTemplate().queryForObject("tp_movback_h.getLastMovno");
	}
}
